#include "sdlButton.h"

using std::string;

sdlButton::sdlButton(): sdlImage::sdlImage(){
}

sdlButton::sdlButton(string path): sdlImage::sdlImage(path){
}

void sdlButton::setPosition(int x, int y){
	this->x = x;
	this->y = y;
}

void sdlButton::getPosition(int& x, int& y){
	x = this->x;
	y = this->y;
}

bool sdlButton::wasClicked(const SDL_Event& event){
	int x, y;
	//SDL_GetMouseState(&x,&y);
	x = event.button.x;
	y = event.button.y;
	if (event.button.button == SDL_BUTTON_LEFT){
		if (x > this->x && x < this->x + this->width() &&
			y > this->y && y < this->y + this->height()){
			return true;
		}
	}
	return false;
}
